package com.hivemc.chunker.conversion.encoding.bedrock.base.resolver.identifier;

import com.hivemc.chunker.conversion.encoding.base.resolver.identifier.state.TypeMapping;
import com.hivemc.chunker.conversion.intermediate.column.chunk.identifier.type.block.states.BlockStateValue;
import com.hivemc.chunker.conversion.intermediate.column.chunk.identifier.type.block.states.vanilla.types.*;

import java.util.ArrayList;
import java.util.List;

/**
 * A list of types which map how values should be converted between Bedrock and Chunker.
 */
public class BedrockStateTypes {
    public static final TypeMapping<Boolean, Age_1> AGE_1 = new TypeMapping.Builder<Boolean, Age_1>()
            .mapping(false, Age_1._0)
            .mapping(true, Age_1._1)
            .build();
    public static final TypeMapping<Integer, Age_15> AGE_15 = new TypeMapping.Builder<Integer, Age_15>()
            .mapping(0, Age_15._0)
            .mapping(1, Age_15._1)
            .mapping(2, Age_15._2)
            .mapping(3, Age_15._3)
            .mapping(4, Age_15._4)
            .mapping(5, Age_15._5)
            .mapping(6, Age_15._6)
            .mapping(7, Age_15._7)
            .mapping(8, Age_15._8)
            .mapping(9, Age_15._9)
            .mapping(10, Age_15._10)
            .mapping(11, Age_15._11)
            .mapping(12, Age_15._12)
            .mapping(13, Age_15._13)
            .mapping(14, Age_15._14)
            .mapping(15, Age_15._15)
            .build();
    public static final TypeMapping<Integer, Age_25> AGE_15_TO_25 = new TypeMapping.Builder<Integer, Age_25>()
            .mapping(0, Age_25._0)
            .mapping(1, Age_25._1)
            .mapping(2, Age_25._2)
            .mapping(3, Age_25._3)
            .mapping(4, Age_25._4)
            .mapping(5, Age_25._5)
            .mapping(6, Age_25._6)
            .mapping(7, Age_25._7)
            .mapping(8, Age_25._8)
            .mapping(9, Age_25._9)
            .mapping(10, Age_25._10)
            .mapping(11, Age_25._11)
            .mapping(12, Age_25._12)
            .mapping(13, Age_25._13)
            .mapping(14, Age_25._14)
            .mapping(15, Age_25._15)
            .mapping(15, Age_25._16)
            .mapping(15, Age_25._17)
            .mapping(15, Age_25._18)
            .mapping(15, Age_25._19)
            .mapping(15, Age_25._20)
            .mapping(15, Age_25._21)
            .mapping(15, Age_25._22)
            .mapping(15, Age_25._23)
            .mapping(15, Age_25._24)
            .mapping(15, Age_25._25)
            .build();
    public static final TypeMapping<Integer, Age_2> AGE_2 = new TypeMapping.Builder<Integer, Age_2>()
            .mapping(0, Age_2._0)
            .mapping(1, Age_2._1)
            .mapping(2, Age_2._2)
            .mapping(3, Age_2._2) // Legacy state which maps back to 2
            .build();
    public static final TypeMapping<Integer, Age_25> AGE_25 = new TypeMapping.Builder<Integer, Age_25>()
            .mapping(0, Age_25._0)
            .mapping(1, Age_25._1)
            .mapping(2, Age_25._2)
            .mapping(3, Age_25._3)
            .mapping(4, Age_25._4)
            .mapping(5, Age_25._5)
            .mapping(6, Age_25._6)
            .mapping(7, Age_25._7)
            .mapping(8, Age_25._8)
            .mapping(9, Age_25._9)
            .mapping(10, Age_25._10)
            .mapping(11, Age_25._11)
            .mapping(12, Age_25._12)
            .mapping(13, Age_25._13)
            .mapping(14, Age_25._14)
            .mapping(15, Age_25._15)
            .mapping(16, Age_25._16)
            .mapping(17, Age_25._17)
            .mapping(18, Age_25._18)
            .mapping(19, Age_25._19)
            .mapping(20, Age_25._20)
            .mapping(21, Age_25._21)
            .mapping(22, Age_25._22)
            .mapping(23, Age_25._23)
            .mapping(24, Age_25._24)
            .mapping(25, Age_25._25)
            .build();
    public static final TypeMapping<Integer, Age_3> AGE_3 = new TypeMapping.Builder<Integer, Age_3>()
            .mapping(0, Age_3._0)
            .mapping(1, Age_3._1)
            .mapping(2, Age_3._2)
            .mapping(3, Age_3._3)
            .build();
    public static final TypeMapping<Integer, Age_4> AGE_4 = new TypeMapping.Builder<Integer, Age_4>()
            .mapping(0, Age_4._0)
            .mapping(1, Age_4._1)
            .mapping(2, Age_4._2)
            .mapping(3, Age_4._3)
            .mapping(4, Age_4._4)
            .build();
    public static final TypeMapping<Integer, Age_5> AGE_5 = new TypeMapping.Builder<Integer, Age_5>()
            .mapping(0, Age_5._0)
            .mapping(1, Age_5._1)
            .mapping(2, Age_5._2)
            .mapping(3, Age_5._3)
            .mapping(4, Age_5._4)
            .mapping(5, Age_5._5)
            .mapping(6, Age_5._5) // Legacy state which maps back to 5
            .mapping(7, Age_5._5) // Legacy state which maps back to 5
            .build();
    public static final TypeMapping<Integer, Age_7> AGE_7 = new TypeMapping.Builder<Integer, Age_7>()
            .mapping(0, Age_7._0)
            .mapping(1, Age_7._1)
            .mapping(2, Age_7._2)
            .mapping(3, Age_7._3)
            .mapping(4, Age_7._4)
            .mapping(5, Age_7._5)
            .mapping(6, Age_7._6)
            .mapping(7, Age_7._7)
            .build();
    public static final TypeMapping<Integer, Age_1> AGE_7_TO_1 = new TypeMapping.Builder<Integer, Age_1>()
            .mapping(0, Age_1._0)
            .mapping(1, Age_1._1)
            .mapping(2, Age_1._1)
            .mapping(3, Age_1._1)
            .mapping(4, Age_1._1)
            .mapping(5, Age_1._1)
            .mapping(6, Age_1._1)
            .mapping(7, Age_1._1)
            .build();
    public static final TypeMapping<Integer, Age_4> AGE_7_TO_4 = new TypeMapping.Builder<Integer, Age_4>()
            .mapping(0, Age_4._0)
            .mapping(1, Age_4._1)
            .mapping(2, Age_4._2)
            .mapping(3, Age_4._3)
            .mapping(4, Age_4._4)
            .mapping(5, Age_4._4)
            .mapping(6, Age_4._4)
            .mapping(7, Age_4._4)
            .build();
    public static final TypeMapping<String, Axis> AXIS = new TypeMapping.Builder<String, Axis>()
            .mapping("x", Axis.X)
            .mapping("y", Axis.Y)
            .mapping("z", Axis.Z)
            .build();
    public static final TypeMapping<Integer, Axis> AXIS_DIRECTION = new TypeMapping.Builder<Integer, Axis>()
            .mapping(0, Axis.Y)
            .mapping(1, Axis.X)
            .mapping(2, Axis.Z)
            .mapping(3, Axis.Y)
            .build();
    public static final TypeMapping<String, AxisHorizontal> AXIS_HORIZONTAL = new TypeMapping.Builder<String, AxisHorizontal>()
            .mapping("z", AxisHorizontal.Z)
            .mapping("x", AxisHorizontal.X)
            .mapping("unknown", AxisHorizontal.X)
            .build();
    public static final TypeMapping<String, Stage> BAMBOO_STALK_THICKNESS = new TypeMapping.Builder<String, Stage>()
            .mapping("thin", Stage._0)
            .mapping("thick", Stage._1)
            .build();
    public static final TypeMapping<Boolean, BedPart> BED_PART = new TypeMapping.Builder<Boolean, BedPart>()
            .mapping(false, BedPart.FOOT)
            .mapping(true, BedPart.HEAD)
            .build();
    public static final TypeMapping<String, BellAttachmentType> BELL_ATTACHMENT = new TypeMapping.Builder<String, BellAttachmentType>()
            .mapping("hanging", BellAttachmentType.CEILING)
            .mapping("side", BellAttachmentType.SINGLE_WALL)
            .mapping("standing", BellAttachmentType.FLOOR)
            .mapping("multiple", BellAttachmentType.DOUBLE_WALL)
            .build();
    public static final TypeMapping<Integer, Bites> BITES = new TypeMapping.Builder<Integer, Bites>()
            .mapping(0, Bites._0)
            .mapping(1, Bites._1)
            .mapping(2, Bites._2)
            .mapping(3, Bites._3)
            .mapping(4, Bites._4)
            .mapping(5, Bites._5)
            .mapping(6, Bites._6)
            .mapping(7, Bites._6) // Legacy state which falls back to 6
            .build();
    public static final TypeMapping<String, FacingDirection> BLOCK_FACE = new TypeMapping.Builder<String, FacingDirection>()
            .mapping("west", FacingDirection.WEST)
            .mapping("up", FacingDirection.UP)
            .mapping("east", FacingDirection.EAST)
            .mapping("south", FacingDirection.SOUTH)
            .mapping("north", FacingDirection.NORTH)
            .mapping("down", FacingDirection.DOWN)
            .build();
    public static final TypeMapping<Integer, Bool> BOOKS_STORED = new TypeMapping.Builder<Integer, Bool>()
            .generate((builder) -> {
                // Convert slot count to six booleans
                for (int input = 0; input < 64; input++) {
                    List<Bool> output = new ArrayList<>(6);
                    for (int j = 0; j < 6; j++) {
                        output.add(((input >> j) & 1) == 1 ? Bool.TRUE : Bool.FALSE);
                    }

                    // Count -> Combination
                    builder.mapping(Integer.bitCount(input), output);
                }
            })
            .build();
    public static final TypeMapping<Boolean, Bool> BOOL = new TypeMapping.Builder<Boolean, Bool>()
            .mapping(false, Bool.FALSE)
            .mapping(true, Bool.TRUE)
            .build();
    public static final TypeMapping<Integer, Bool> BOOLS_TO_VINE_DIRECTION = new TypeMapping.Builder<Integer, Bool>()
            .generate((builder) -> {
                // Convert south, west, north, east into an integer
                for (int input = 0; input < 16; input++) {
                    List<Bool> output = new ArrayList<>(4);
                    for (int j = 0; j < 4; j++) {
                        output.add(((input >> j) & 1) == 1 ? Bool.TRUE : Bool.FALSE);
                    }
                    builder.mapping(input, output);
                }
            })
            .build();
    public static final TypeMapping<Boolean, Bool> BOOL_DEFAULT_FALSE = new TypeMapping.Builder<Boolean, Bool>()
            .mapping(false, Bool.FALSE)
            .mapping(true, Bool.TRUE)
            .defaults(false, Bool.FALSE)
            .build();
    public static final TypeMapping<Boolean, Bool> BOOL_DEFAULT_TRUE = new TypeMapping.Builder<Boolean, Bool>()
            .mapping(false, Bool.FALSE)
            .mapping(true, Bool.TRUE)
            .defaults(true, Bool.TRUE)
            .build();
    public static final TypeMapping<Boolean, SculkSensorPhase> BOOL_TO_SCULK_SENSOR_PHASE = new TypeMapping.Builder<Boolean, SculkSensorPhase>()
            .mapping(false, SculkSensorPhase.INACTIVE)
            .mapping(true, SculkSensorPhase.ACTIVE)
            .mapping(true, SculkSensorPhase.COOLDOWN)
            .build();
    public static final TypeMapping<Integer, Dusted> BRUSHED_PROGRESS = new TypeMapping.Builder<Integer, Dusted>()
            .mapping(0, Dusted._0)
            .mapping(1, Dusted._1)
            .mapping(2, Dusted._2)
            .mapping(3, Dusted._3)
            .build();
    public static final TypeMapping<Integer, Candles> CANDLES = new TypeMapping.Builder<Integer, Candles>()
            .mapping(0, Candles._1)
            .mapping(1, Candles._2)
            .mapping(2, Candles._3)
            .mapping(3, Candles._4)
            .build();
    public static final TypeMapping<String, FacingDirectionHorizontal> CARDINAL_DIRECTION = new TypeMapping.Builder<String, FacingDirectionHorizontal>()
            .mapping("north", FacingDirectionHorizontal.NORTH)
            .mapping("east", FacingDirectionHorizontal.EAST)
            .mapping("south", FacingDirectionHorizontal.SOUTH)
            .mapping("west", FacingDirectionHorizontal.WEST)
            .build();
    public static final TypeMapping<String, FacingDirectionHorizontal> CARDINAL_DIRECTION_DOOR = new TypeMapping.Builder<String, FacingDirectionHorizontal>()
            .mapping("north", FacingDirectionHorizontal.WEST)
            .mapping("east", FacingDirectionHorizontal.NORTH)
            .mapping("south", FacingDirectionHorizontal.EAST)
            .mapping("west", FacingDirectionHorizontal.SOUTH)
            .build();
    public static final TypeMapping<Integer, FacingDirectionHorizontal> CARDINAL_DIRECTION_LEGACY = new TypeMapping.Builder<Integer, FacingDirectionHorizontal>()
            .mapping(0, FacingDirectionHorizontal.SOUTH)
            .mapping(1, FacingDirectionHorizontal.WEST)
            .mapping(2, FacingDirectionHorizontal.NORTH)
            .mapping(3, FacingDirectionHorizontal.EAST)
            .build();
    public static final TypeMapping<Integer, FacingDirectionHorizontal> CARDINAL_DIRECTION_LEGACY_INVERTED = new TypeMapping.Builder<Integer, FacingDirectionHorizontal>()
            .mapping(0, FacingDirectionHorizontal.NORTH)
            .mapping(1, FacingDirectionHorizontal.EAST)
            .mapping(2, FacingDirectionHorizontal.SOUTH)
            .mapping(3, FacingDirectionHorizontal.WEST)
            .build();
    public static final TypeMapping<Integer, CauldronLevel> CAULDRON_LEVEL = new TypeMapping.Builder<Integer, CauldronLevel>()
            .mapping(1, CauldronLevel._1)
            .mapping(2, CauldronLevel._2)
            .mapping(3, CauldronLevel._3)
            .mapping(4, CauldronLevel._4)
            .mapping(5, CauldronLevel._5)
            .mapping(6, CauldronLevel._6)
            .mapping(7, CauldronLevel._6) // Legacy state which falls back to 6
            .build();
    public static final TypeMapping<Boolean, ComparatorMode> COMPARATOR_MODE = new TypeMapping.Builder<Boolean, ComparatorMode>()
            .mapping(false, ComparatorMode.COMPARE)
            .mapping(true, ComparatorMode.SUBTRACT)
            .build();
    public static final TypeMapping<Integer, ComposterLevel> COMPOSTER_LEVEL = new TypeMapping.Builder<Integer, ComposterLevel>()
            .mapping(0, ComposterLevel._0)
            .mapping(1, ComposterLevel._1)
            .mapping(2, ComposterLevel._2)
            .mapping(3, ComposterLevel._3)
            .mapping(4, ComposterLevel._4)
            .mapping(5, ComposterLevel._5)
            .mapping(6, ComposterLevel._6)
            .mapping(7, ComposterLevel._7)
            .mapping(8, ComposterLevel._8)
            .mapping(9, ComposterLevel._8) // Legacy state which maps to 8
            .mapping(10, ComposterLevel._8) // Legacy state which maps to 8
            .mapping(11, ComposterLevel._8) // Legacy state which maps to 8
            .mapping(12, ComposterLevel._8) // Legacy state which maps to 8
            .mapping(13, ComposterLevel._8) // Legacy state which maps to 8
            .mapping(14, ComposterLevel._8) // Legacy state which maps to 8
            .mapping(15, ComposterLevel._8) // Legacy state which maps to 8
            .build();
    public static final TypeMapping<Integer, FacingDirectionHorizontal> CORAL_DIRECTION = new TypeMapping.Builder<Integer, FacingDirectionHorizontal>()
            .mapping(0, FacingDirectionHorizontal.WEST)
            .mapping(1, FacingDirectionHorizontal.EAST)
            .mapping(2, FacingDirectionHorizontal.NORTH)
            .mapping(3, FacingDirectionHorizontal.SOUTH)
            .build();
    public static final TypeMapping<Integer, CoralFanDirection> CORAL_FAN_DIRECTION = new TypeMapping.Builder<Integer, CoralFanDirection>()
            .mapping(0, CoralFanDirection.EAST_WEST)
            .mapping(1, CoralFanDirection.NORTH_SOUTH)
            .build();
    public static final TypeMapping<Boolean, Creaking> CREAKING_BOOL = new TypeMapping.Builder<Boolean, Creaking>()
            .mapping(false, Creaking.DORMANT)
            .mapping(false, Creaking.DISABLED)
            .mapping(true, Creaking.ACTIVE)
            .build();
    public static final TypeMapping<String, Creaking> CREAKING = new TypeMapping.Builder<String, Creaking>()
            .mapping("uprooted", Creaking.DISABLED)
            .mapping("dormant", Creaking.DORMANT)
            .mapping("awake", Creaking.ACTIVE)
            .build();
    public static final TypeMapping<Integer, Delay> DELAY = new TypeMapping.Builder<Integer, Delay>()
            .mapping(0, Delay._1)
            .mapping(1, Delay._2)
            .mapping(2, Delay._3)
            .mapping(3, Delay._4)
            .build();
    public static final TypeMapping<Integer, FacingDirectionHorizontal> DOOR_DIRECTION = new TypeMapping.Builder<Integer, FacingDirectionHorizontal>()
            .mapping(0, FacingDirectionHorizontal.EAST)
            .mapping(1, FacingDirectionHorizontal.SOUTH)
            .mapping(2, FacingDirectionHorizontal.WEST)
            .mapping(3, FacingDirectionHorizontal.NORTH)
            .build();
    public static final TypeMapping<String, DripstoneThickness> DRIPSTONE_THICKNESS = new TypeMapping.Builder<String, DripstoneThickness>()
            .mapping("merge", DripstoneThickness.TIP_MERGE)
            .mapping("middle", DripstoneThickness.MIDDLE)
            .mapping("tip", DripstoneThickness.TIP)
            .mapping("frustum", DripstoneThickness.FRUSTUM)
            .mapping("base", DripstoneThickness.BASE)
            .build();
    public static final TypeMapping<String, Eggs> EGGS = new TypeMapping.Builder<String, Eggs>()
            .mapping("one_egg", Eggs._1)
            .mapping("two_egg", Eggs._2)
            .mapping("three_egg", Eggs._3)
            .mapping("four_egg", Eggs._4)
            .build();
    public static final TypeMapping<String, FacingDirection> FACING_DIRECTION = new TypeMapping.Builder<String, FacingDirection>()
            .mapping("west", FacingDirection.WEST)
            .mapping("up", FacingDirection.UP)
            .mapping("east", FacingDirection.EAST)
            .mapping("south", FacingDirection.SOUTH)
            .mapping("north", FacingDirection.NORTH)
            .mapping("down", FacingDirection.DOWN)
            .build();
    public static final TypeMapping<Integer, FacingDirection> FACING_DIRECTION_LEGACY = new TypeMapping.Builder<Integer, FacingDirection>()
            .mapping(0, FacingDirection.DOWN)
            .mapping(1, FacingDirection.UP)
            .mapping(2, FacingDirection.NORTH)
            .mapping(3, FacingDirection.SOUTH)
            .mapping(4, FacingDirection.WEST)
            .mapping(5, FacingDirection.EAST)
            .mapping(6, FacingDirection.DOWN) // Legacy state which falls back to down
            .mapping(7, FacingDirection.DOWN) // Legacy state which falls back to down
            .build();
    public static final TypeMapping<Integer, FacingDirectionHorizontalDown> FACING_DIRECTION_LEGACY_DOWN = new TypeMapping.Builder<Integer, FacingDirectionHorizontalDown>()
            .mapping(0, FacingDirectionHorizontalDown.DOWN)
            .mapping(1, FacingDirectionHorizontalDown.DOWN)
            .mapping(2, FacingDirectionHorizontalDown.NORTH)
            .mapping(3, FacingDirectionHorizontalDown.SOUTH)
            .mapping(4, FacingDirectionHorizontalDown.WEST)
            .mapping(5, FacingDirectionHorizontalDown.EAST)
            .mapping(6, FacingDirectionHorizontalDown.DOWN) // Legacy state which falls back to down
            .mapping(7, FacingDirectionHorizontalDown.DOWN) // Legacy state which falls back to down
            .build();
    public static final TypeMapping<Integer, FacingDirectionHorizontal> FACING_DIRECTION_LEGACY_HORIZONTAL = new TypeMapping.Builder<Integer, FacingDirectionHorizontal>()
            .mapping(2, FacingDirectionHorizontal.NORTH)
            .mapping(3, FacingDirectionHorizontal.SOUTH)
            .mapping(4, FacingDirectionHorizontal.WEST)
            .mapping(5, FacingDirectionHorizontal.EAST)
            .mapping(0, FacingDirectionHorizontal.NORTH)
            .mapping(1, FacingDirectionHorizontal.NORTH)
            .mapping(6, FacingDirectionHorizontal.NORTH) // Legacy state which falls back to north
            .mapping(7, FacingDirectionHorizontal.NORTH) // Legacy state which falls back to north
            .build();
    public static final TypeMapping<Integer, Orientation> FACING_DIRECTION_ROTATION_TO_ORIENTATION = new TypeMapping.Builder<Integer, Orientation>()
            .mapping(0, 0, Orientation.DOWN_NORTH)
            .mapping(0, 1, Orientation.DOWN_WEST)
            .mapping(0, 2, Orientation.DOWN_SOUTH)
            .mapping(0, 3, Orientation.DOWN_EAST)
            .mapping(1, 0, Orientation.UP_NORTH)
            .mapping(1, 1, Orientation.UP_EAST)
            .mapping(1, 2, Orientation.UP_SOUTH)
            .mapping(1, 3, Orientation.UP_WEST)
            .mapping(2, 0, Orientation.NORTH_UP)
            .mapping(2, 1, Orientation.NORTH_UP)
            .mapping(2, 2, Orientation.NORTH_UP)
            .mapping(2, 3, Orientation.NORTH_UP)
            .mapping(3, 0, Orientation.SOUTH_UP)
            .mapping(3, 1, Orientation.SOUTH_UP)
            .mapping(3, 2, Orientation.SOUTH_UP)
            .mapping(3, 3, Orientation.SOUTH_UP)
            .mapping(4, 0, Orientation.WEST_UP)
            .mapping(4, 1, Orientation.WEST_UP)
            .mapping(4, 2, Orientation.WEST_UP)
            .mapping(4, 3, Orientation.WEST_UP)
            .mapping(5, 0, Orientation.EAST_UP)
            .mapping(5, 1, Orientation.EAST_UP)
            .mapping(5, 2, Orientation.EAST_UP)
            .mapping(5, 3, Orientation.EAST_UP)
            .build();
    public static final TypeMapping<Integer, BlockStateValue> FACING_DIRECTION_TO_ATTACHMENT_FACING_DIRECTION = new TypeMapping.Builder<Integer, BlockStateValue>()
            .mapping(0, AttachmentType.CEILING, FacingDirectionHorizontal.NORTH)
            .mapping(0, AttachmentType.CEILING, FacingDirectionHorizontal.EAST)
            .mapping(0, AttachmentType.CEILING, FacingDirectionHorizontal.SOUTH)
            .mapping(0, AttachmentType.CEILING, FacingDirectionHorizontal.WEST)
            .mapping(1, AttachmentType.FLOOR, FacingDirectionHorizontal.NORTH)
            .mapping(1, AttachmentType.FLOOR, FacingDirectionHorizontal.EAST)
            .mapping(1, AttachmentType.FLOOR, FacingDirectionHorizontal.SOUTH)
            .mapping(1, AttachmentType.FLOOR, FacingDirectionHorizontal.WEST)
            .mapping(2, AttachmentType.WALL, FacingDirectionHorizontal.NORTH)
            .mapping(3, AttachmentType.WALL, FacingDirectionHorizontal.SOUTH)
            .mapping(4, AttachmentType.WALL, FacingDirectionHorizontal.WEST)
            .mapping(5, AttachmentType.WALL, FacingDirectionHorizontal.EAST)
            .mapping(6, AttachmentType.CEILING, FacingDirectionHorizontal.NORTH) // Legacy state which uses north ceiling
            .mapping(7, AttachmentType.CEILING, FacingDirectionHorizontal.NORTH) // Legacy state which uses north ceiling
            .build();
    public static final TypeMapping<Integer, Orientation> FACING_DIRECTION_TO_ORIENTATION = new TypeMapping.Builder<Integer, Orientation>()
            .mapping(0, Orientation.DOWN_NORTH)
            .mapping(0, Orientation.DOWN_WEST)
            .mapping(0, Orientation.DOWN_SOUTH)
            .mapping(0, Orientation.DOWN_EAST)
            .mapping(1, Orientation.UP_NORTH)
            .mapping(1, Orientation.UP_EAST)
            .mapping(1, Orientation.UP_SOUTH)
            .mapping(1, Orientation.UP_WEST)
            .mapping(2, Orientation.NORTH_UP)
            .mapping(3, Orientation.SOUTH_UP)
            .mapping(4, Orientation.WEST_UP)
            .mapping(5, Orientation.EAST_UP)
            .mapping(6, Orientation.DOWN_NORTH) // Legacy state which maps to down north
            .mapping(7, Orientation.DOWN_NORTH) // Legacy state which maps to down north
            .build();
    public static final TypeMapping<Integer, Rotation> FACING_DIRECTION_TO_ROTATION = new TypeMapping.Builder<Integer, Rotation>()
            .mapping(2, Rotation._8)
            .mapping(2, Rotation._9)
            .mapping(2, Rotation._10)
            .mapping(2, Rotation._11)
            .mapping(3, Rotation._0)
            .mapping(3, Rotation._1)
            .mapping(3, Rotation._2)
            .mapping(3, Rotation._3)
            .mapping(4, Rotation._4)
            .mapping(4, Rotation._5)
            .mapping(4, Rotation._6)
            .mapping(4, Rotation._7)
            .mapping(5, Rotation._12)
            .mapping(5, Rotation._13)
            .mapping(5, Rotation._14)
            .mapping(5, Rotation._15)
            .build();
    public static final TypeMapping<Integer, FacingDirection> FLIPPED_FACING_DIRECTION = new TypeMapping.Builder<Integer, FacingDirection>()
            .mapping(0, FacingDirection.DOWN)
            .mapping(1, FacingDirection.UP)
            .mapping(2, FacingDirection.SOUTH)
            .mapping(3, FacingDirection.NORTH)
            .mapping(4, FacingDirection.EAST)
            .mapping(5, FacingDirection.WEST)
            .mapping(6, FacingDirection.DOWN) // Legacy state which falls back to down
            .mapping(7, FacingDirection.DOWN) // Legacy state which falls back to down
            .build();
    public static final TypeMapping<Integer, Flowers> FLOWER_COUNT = new TypeMapping.Builder<Integer, Flowers>()
            .mapping(0, Flowers._1)
            .mapping(1, Flowers._2)
            .mapping(2, Flowers._3)
            .mapping(3, Flowers._4)
            .mapping(4, Flowers._4)
            .mapping(5, Flowers._4)
            .mapping(6, Flowers._4)
            .mapping(7, Flowers._4)
            .build();
    public static final TypeMapping<Integer, LiquidLevel> FLOWING_LEVEL = new TypeMapping.Builder<Integer, LiquidLevel>()
            .mapping(0, LiquidLevel._0)
            .mapping(1, LiquidLevel._1)
            .mapping(2, LiquidLevel._2)
            .mapping(3, LiquidLevel._3)
            .mapping(4, LiquidLevel._4)
            .mapping(5, LiquidLevel._5)
            .mapping(6, LiquidLevel._6)
            .mapping(7, LiquidLevel._7)
            .mapping(8, LiquidLevel._8)
            .mapping(9, LiquidLevel._9)
            .mapping(10, LiquidLevel._10)
            .mapping(11, LiquidLevel._11)
            .mapping(12, LiquidLevel._12)
            .mapping(13, LiquidLevel._13)
            .mapping(14, LiquidLevel._14)
            .mapping(15, LiquidLevel._15)
            .build();
    public static final TypeMapping<String, GrindstoneAttachmentType> GRINDSTONE_ATTACHMENT = new TypeMapping.Builder<String, GrindstoneAttachmentType>()
            .mapping("standing", GrindstoneAttachmentType.FLOOR)
            .mapping("hanging", GrindstoneAttachmentType.CEILING)
            .mapping("side", GrindstoneAttachmentType.WALL)
            .mapping("multiple", GrindstoneAttachmentType.MULTIPLE)
            .build();
    public static final TypeMapping<Boolean, Half> HALF = new TypeMapping.Builder<Boolean, Half>()
            .mapping(false, Half.BOTTOM)
            .mapping(true, Half.TOP)
            .build();
    public static final TypeMapping<String, Hatch> HATCH = new TypeMapping.Builder<String, Hatch>()
            .mapping("no_cracks", Hatch._0)
            .mapping("cracked", Hatch._1)
            .mapping("max_cracked", Hatch._2)
            .build();
    public static final TypeMapping<Boolean, HingeSide> HINGE = new TypeMapping.Builder<Boolean, HingeSide>()
            .mapping(false, HingeSide.LEFT)
            .mapping(true, HingeSide.RIGHT)
            .build();
    public static final TypeMapping<Integer, HoneyLevel> HONEY_LEVEL = new TypeMapping.Builder<Integer, HoneyLevel>()
            .mapping(0, HoneyLevel._0)
            .mapping(1, HoneyLevel._1)
            .mapping(2, HoneyLevel._2)
            .mapping(3, HoneyLevel._3)
            .mapping(4, HoneyLevel._4)
            .mapping(5, HoneyLevel._5)
            .build();
    public static final TypeMapping<Boolean, Bool> INVERSE_BOOL = new TypeMapping.Builder<Boolean, Bool>()
            .mapping(false, Bool.TRUE)
            .mapping(true, Bool.FALSE)
            .build();
    public static final TypeMapping<Integer, Layers> LAYERS = new TypeMapping.Builder<Integer, Layers>()
            .mapping(0, Layers._1)
            .mapping(1, Layers._2)
            .mapping(2, Layers._3)
            .mapping(3, Layers._4)
            .mapping(4, Layers._5)
            .mapping(5, Layers._6)
            .mapping(6, Layers._7)
            .mapping(7, Layers._8)
            .build();
    public static final TypeMapping<String, BambooLeafSize> LEAVES = new TypeMapping.Builder<String, BambooLeafSize>()
            .mapping("no_leaves", BambooLeafSize.NONE)
            .mapping("small_leaves", BambooLeafSize.SMALL)
            .mapping("large_leaves", BambooLeafSize.LARGE)
            .build();
    public static final TypeMapping<Object, BlockStateValue> LEVER_DIRECTION_POWER = new TypeMapping.Builder<>()
            .mapping(List.of("up_north_south", false), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.NORTH, Bool.FALSE))
            .mapping(List.of("up_north_south", true), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.SOUTH, Bool.FALSE))
            .mapping(List.of("up_north_south", true), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.NORTH, Bool.TRUE))
            .mapping(List.of("up_north_south", false), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.SOUTH, Bool.TRUE))
            .mapping(List.of("up_east_west", true), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.EAST, Bool.FALSE))
            .mapping(List.of("up_east_west", false), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.WEST, Bool.FALSE))
            .mapping(List.of("up_east_west", false), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.EAST, Bool.TRUE))
            .mapping(List.of("up_east_west", true), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.WEST, Bool.TRUE))
            .mapping(List.of("north", false), List.of(AttachmentType.WALL, FacingDirectionHorizontal.NORTH, Bool.FALSE))
            .mapping(List.of("north", true), List.of(AttachmentType.WALL, FacingDirectionHorizontal.NORTH, Bool.TRUE))
            .mapping(List.of("east", false), List.of(AttachmentType.WALL, FacingDirectionHorizontal.EAST, Bool.FALSE))
            .mapping(List.of("east", true), List.of(AttachmentType.WALL, FacingDirectionHorizontal.EAST, Bool.TRUE))
            .mapping(List.of("south", false), List.of(AttachmentType.WALL, FacingDirectionHorizontal.SOUTH, Bool.FALSE))
            .mapping(List.of("south", true), List.of(AttachmentType.WALL, FacingDirectionHorizontal.SOUTH, Bool.TRUE))
            .mapping(List.of("west", false), List.of(AttachmentType.WALL, FacingDirectionHorizontal.WEST, Bool.FALSE))
            .mapping(List.of("west", true), List.of(AttachmentType.WALL, FacingDirectionHorizontal.WEST, Bool.TRUE))
            .mapping(List.of("down_north_south", false), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.NORTH, Bool.FALSE))
            .mapping(List.of("down_north_south", true), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.SOUTH, Bool.FALSE))
            .mapping(List.of("down_north_south", true), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.NORTH, Bool.TRUE))
            .mapping(List.of("down_north_south", false), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.SOUTH, Bool.TRUE))
            .mapping(List.of("down_east_west", true), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.EAST, Bool.FALSE))
            .mapping(List.of("down_east_west", false), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.WEST, Bool.FALSE))
            .mapping(List.of("down_east_west", false), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.EAST, Bool.TRUE))
            .mapping(List.of("down_east_west", true), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.WEST, Bool.TRUE))
            .build();
    public static final TypeMapping<Object, BlockStateValue> LEVER_FACING_DIRECTION_POWER_LEGACY = new TypeMapping.Builder<>()
            .mapping(List.of(0, true), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.EAST, Bool.FALSE))
            .mapping(List.of(0, false), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.WEST, Bool.FALSE))
            .mapping(List.of(0, false), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.EAST, Bool.TRUE))
            .mapping(List.of(0, true), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.WEST, Bool.TRUE))
            .mapping(List.of(1, false), List.of(AttachmentType.WALL, FacingDirectionHorizontal.EAST, Bool.FALSE))
            .mapping(List.of(1, true), List.of(AttachmentType.WALL, FacingDirectionHorizontal.EAST, Bool.TRUE))
            .mapping(List.of(2, false), List.of(AttachmentType.WALL, FacingDirectionHorizontal.WEST, Bool.FALSE))
            .mapping(List.of(2, true), List.of(AttachmentType.WALL, FacingDirectionHorizontal.WEST, Bool.TRUE))
            .mapping(List.of(3, false), List.of(AttachmentType.WALL, FacingDirectionHorizontal.SOUTH, Bool.FALSE))
            .mapping(List.of(3, true), List.of(AttachmentType.WALL, FacingDirectionHorizontal.SOUTH, Bool.TRUE))
            .mapping(List.of(4, false), List.of(AttachmentType.WALL, FacingDirectionHorizontal.NORTH, Bool.FALSE))
            .mapping(List.of(4, true), List.of(AttachmentType.WALL, FacingDirectionHorizontal.NORTH, Bool.TRUE))
            .mapping(List.of(5, false), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.NORTH, Bool.FALSE))
            .mapping(List.of(5, true), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.SOUTH, Bool.FALSE))
            .mapping(List.of(5, true), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.NORTH, Bool.TRUE))
            .mapping(List.of(5, false), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.SOUTH, Bool.TRUE))
            .mapping(List.of(6, true), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.EAST, Bool.FALSE))
            .mapping(List.of(6, false), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.WEST, Bool.FALSE))
            .mapping(List.of(6, false), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.EAST, Bool.TRUE))
            .mapping(List.of(6, true), List.of(AttachmentType.FLOOR, FacingDirectionHorizontal.WEST, Bool.TRUE))
            .mapping(List.of(7, false), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.NORTH, Bool.FALSE))
            .mapping(List.of(7, true), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.SOUTH, Bool.FALSE))
            .mapping(List.of(7, true), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.NORTH, Bool.TRUE))
            .mapping(List.of(7, false), List.of(AttachmentType.CEILING, FacingDirectionHorizontal.SOUTH, Bool.TRUE))
            .build();
    public static final TypeMapping<Integer, LightLevel> LIGHT = new TypeMapping.Builder<Integer, LightLevel>()
            .mapping(0, LightLevel._0)
            .mapping(1, LightLevel._1)
            .mapping(2, LightLevel._2)
            .mapping(3, LightLevel._3)
            .mapping(4, LightLevel._4)
            .mapping(5, LightLevel._5)
            .mapping(6, LightLevel._6)
            .mapping(7, LightLevel._7)
            .mapping(8, LightLevel._8)
            .mapping(9, LightLevel._9)
            .mapping(10, LightLevel._10)
            .mapping(11, LightLevel._11)
            .mapping(12, LightLevel._12)
            .mapping(13, LightLevel._13)
            .mapping(14, LightLevel._14)
            .mapping(15, LightLevel._15)
            .build();
    public static final TypeMapping<Integer, Moisture> MOISTURE = new TypeMapping.Builder<Integer, Moisture>()
            .mapping(0, Moisture._0)
            .mapping(1, Moisture._1)
            .mapping(2, Moisture._2)
            .mapping(3, Moisture._3)
            .mapping(4, Moisture._4)
            .mapping(5, Moisture._5)
            .mapping(6, Moisture._6)
            .mapping(7, Moisture._7)
            .build();
    public static final TypeMapping<Integer, Bool> MULTIFACE_DIRECTION = new TypeMapping.Builder<Integer, Bool>()
            .generate((builder) -> {
                // Convert down, up, south, west, north, east into an integer
                for (int input = 0; input < 64; input++) {
                    List<Bool> output = new ArrayList<>(6);
                    for (int j = 0; j < 6; j++) {
                        output.add(((input >> j) & 1) == 1 ? Bool.TRUE : Bool.FALSE);
                    }
                    builder.mapping(input, output);
                }
            })
            .build();
    public static final TypeMapping<Integer, Bool> MUSHROOM_FACE_BITS = new TypeMapping.Builder<Integer, Bool>()
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE))
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE))
            .mapping(3, List.of(Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE))
            .mapping(1, List.of(Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE))
            .mapping(2, List.of(Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE))
            .mapping(9, List.of(Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE))
            .mapping(6, List.of(Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE))
            .mapping(7, List.of(Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE))
            .mapping(8, List.of(Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE))
            .mapping(4, List.of(Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE))
            .mapping(5, List.of(Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE))
            .mapping(0, List.of(Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE))
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE))
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE))
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE))
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE))
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE))
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE))
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE))
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE))
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE))
            .mapping(14, List.of(Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE))
            .mapping(3, List.of(Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE))
            .mapping(3, List.of(Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE))
            .mapping(3, List.of(Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE))
            .mapping(14, List.of(Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE))
            .mapping(14, List.of(Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE))
            .mapping(14, List.of(Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE))
            .mapping(14, List.of(Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE))
            .mapping(14, List.of(Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE))
            .mapping(14, List.of(Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE))
            .mapping(14, List.of(Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE))
            .mapping(0, List.of(Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE))
            .mapping(1, List.of(Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE))
            .mapping(1, List.of(Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE))
            .mapping(1, List.of(Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE))
            .mapping(2, List.of(Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE))
            .mapping(2, List.of(Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE))
            .mapping(2, List.of(Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE))
            .mapping(14, List.of(Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE))
            .mapping(14, List.of(Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE))
            .mapping(14, List.of(Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE))
            .mapping(14, List.of(Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE))
            .mapping(9, List.of(Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE))
            .mapping(9, List.of(Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE))
            .mapping(9, List.of(Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE))
            .mapping(14, List.of(Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE))
            .mapping(14, List.of(Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE))
            .mapping(14, List.of(Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE))
            .mapping(0, List.of(Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE))
            .mapping(6, List.of(Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE))
            .mapping(6, List.of(Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE))
            .mapping(6, List.of(Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE))
            .mapping(7, List.of(Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE, Bool.TRUE))
            .mapping(7, List.of(Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.TRUE))
            .mapping(7, List.of(Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.FALSE, Bool.FALSE))
            .mapping(8, List.of(Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE, Bool.TRUE))
            .mapping(8, List.of(Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.TRUE))
            .mapping(8, List.of(Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE, Bool.FALSE))
            .mapping(4, List.of(Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE, Bool.TRUE))
            .mapping(4, List.of(Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.TRUE))
            .mapping(4, List.of(Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.FALSE, Bool.FALSE))
            .mapping(0, List.of(Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE, Bool.TRUE))
            .mapping(0, List.of(Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.TRUE))
            // Pores only
            .mapping(13, List.of(Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE))
            .mapping(12, List.of(Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE))
            .mapping(11, List.of(Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE, Bool.FALSE))
            .build();
    public static final TypeMapping<String, Orientation> ORIENTATION = new TypeMapping.Builder<String, Orientation>()
            .mapping("up_south", Orientation.UP_NORTH)
            .mapping("down_west", Orientation.DOWN_WEST)
            .mapping("up_east", Orientation.UP_WEST)
            .mapping("up_north", Orientation.UP_SOUTH)
            .mapping("down_north", Orientation.DOWN_NORTH)
            .mapping("west_up", Orientation.WEST_UP)
            .mapping("north_up", Orientation.NORTH_UP)
            .mapping("down_south", Orientation.DOWN_SOUTH)
            .mapping("up_west", Orientation.UP_EAST)
            .mapping("south_up", Orientation.SOUTH_UP)
            .mapping("east_up", Orientation.EAST_UP)
            .mapping("down_east", Orientation.DOWN_EAST)
            .build();
    public static final TypeMapping<Integer, Pickles> PICKLES = new TypeMapping.Builder<Integer, Pickles>()
            .mapping(0, Pickles._1)
            .mapping(1, Pickles._2)
            .mapping(2, Pickles._3)
            .mapping(3, Pickles._4)
            .build();
    public static final TypeMapping<Integer, Power> POWER = new TypeMapping.Builder<Integer, Power>()
            .mapping(0, Power._0)
            .mapping(1, Power._1)
            .mapping(2, Power._2)
            .mapping(3, Power._3)
            .mapping(4, Power._4)
            .mapping(5, Power._5)
            .mapping(6, Power._6)
            .mapping(7, Power._7)
            .mapping(8, Power._8)
            .mapping(9, Power._9)
            .mapping(10, Power._10)
            .mapping(11, Power._11)
            .mapping(12, Power._12)
            .mapping(13, Power._13)
            .mapping(14, Power._14)
            .mapping(15, Power._15)
            .build();
    public static final TypeMapping<Integer, RailShape> RAIL_SHAPE = new TypeMapping.Builder<Integer, RailShape>()
            .mapping(0, RailShape.NORTH_SOUTH)
            .mapping(1, RailShape.EAST_WEST)
            .mapping(2, RailShape.ASCENDING_EAST)
            .mapping(3, RailShape.ASCENDING_WEST)
            .mapping(4, RailShape.ASCENDING_NORTH)
            .mapping(5, RailShape.ASCENDING_SOUTH)
            .mapping(6, RailShape.SOUTH_EAST)
            .mapping(7, RailShape.SOUTH_WEST)
            .mapping(8, RailShape.NORTH_WEST)
            .mapping(9, RailShape.NORTH_EAST)
            .mapping(10, RailShape.NORTH_SOUTH) // Legacy state which falls back to north-south
            .mapping(11, RailShape.NORTH_SOUTH) // Legacy state which falls back to north-south
            .mapping(12, RailShape.NORTH_SOUTH) // Legacy state which falls back to north-south
            .mapping(13, RailShape.NORTH_SOUTH) // Legacy state which falls back to north-south
            .mapping(14, RailShape.NORTH_SOUTH) // Legacy state which falls back to north-south
            .mapping(15, RailShape.NORTH_SOUTH) // Legacy state which falls back to north-south
            .build();
    public static final TypeMapping<Integer, Bool> REDSTONE_SIGNAL_TO_BOOL = new TypeMapping.Builder<Integer, Bool>()
            .mapping(0, Bool.FALSE)
            .mapping(1, Bool.TRUE)
            .mapping(2, Bool.TRUE)
            .mapping(3, Bool.TRUE)
            .mapping(4, Bool.TRUE)
            .mapping(5, Bool.TRUE)
            .mapping(6, Bool.TRUE)
            .mapping(7, Bool.TRUE)
            .mapping(8, Bool.TRUE)
            .mapping(9, Bool.TRUE)
            .mapping(10, Bool.TRUE)
            .mapping(11, Bool.TRUE)
            .mapping(12, Bool.TRUE)
            .mapping(13, Bool.TRUE)
            .mapping(14, Bool.TRUE)
            .mapping(15, Bool.TRUE)
            .build();
    public static final TypeMapping<Integer, RespawnAnchorCharges> RESPAWN_ANCHOR_CHARGE = new TypeMapping.Builder<Integer, RespawnAnchorCharges>()
            .mapping(0, RespawnAnchorCharges._0)
            .mapping(1, RespawnAnchorCharges._1)
            .mapping(2, RespawnAnchorCharges._2)
            .mapping(3, RespawnAnchorCharges._3)
            .mapping(4, RespawnAnchorCharges._4)
            .build();
    public static final TypeMapping<Integer, Rotation> ROTATION = new TypeMapping.Builder<Integer, Rotation>()
            .mapping(0, Rotation._0)
            .mapping(1, Rotation._1)
            .mapping(2, Rotation._2)
            .mapping(3, Rotation._3)
            .mapping(4, Rotation._4)
            .mapping(5, Rotation._5)
            .mapping(6, Rotation._6)
            .mapping(7, Rotation._7)
            .mapping(8, Rotation._8)
            .mapping(9, Rotation._9)
            .mapping(10, Rotation._10)
            .mapping(11, Rotation._11)
            .mapping(12, Rotation._12)
            .mapping(13, Rotation._13)
            .mapping(14, Rotation._14)
            .mapping(15, Rotation._15)
            .build();
    public static final TypeMapping<Integer, SculkSensorPhase> SCULK_SENSOR_PHASE = new TypeMapping.Builder<Integer, SculkSensorPhase>()
            .mapping(0, SculkSensorPhase.INACTIVE)
            .mapping(1, SculkSensorPhase.ACTIVE)
            .mapping(2, SculkSensorPhase.COOLDOWN)
            .build();
    public static final TypeMapping<Integer, Segments> SEGMENT_COUNT = new TypeMapping.Builder<Integer, Segments>()
            .mapping(0, Segments._1)
            .mapping(1, Segments._2)
            .mapping(2, Segments._3)
            .mapping(3, Segments._4)
            .mapping(4, Segments._4)
            .mapping(5, Segments._4)
            .mapping(6, Segments._4)
            .mapping(7, Segments._4)
            .build();
    public static final TypeMapping<String, SlabType> SLAB_TYPE = new TypeMapping.Builder<String, SlabType>()
            .mapping("top", SlabType.TOP)
            .mapping("bottom", SlabType.BOTTOM)
            .mapping("bottom", SlabType.DOUBLE)
            .build();
    public static final TypeMapping<Boolean, SlabType> SLAB_TYPE_LEGACY = new TypeMapping.Builder<Boolean, SlabType>()
            .mapping(false, SlabType.BOTTOM)
            .mapping(true, SlabType.TOP)
            .mapping(false, SlabType.DOUBLE)
            .build();
    public static final TypeMapping<Integer, StabilityDistance> STABILITY_DISTANCE = new TypeMapping.Builder<Integer, StabilityDistance>()
            .mapping(0, StabilityDistance._0)
            .mapping(1, StabilityDistance._1)
            .mapping(2, StabilityDistance._2)
            .mapping(3, StabilityDistance._3)
            .mapping(4, StabilityDistance._4)
            .mapping(5, StabilityDistance._5)
            .mapping(6, StabilityDistance._6)
            .mapping(7, StabilityDistance._7)
            .build();
    public static final TypeMapping<Boolean, Stage> STAGE = new TypeMapping.Builder<Boolean, Stage>()
            .mapping(false, Stage._0)
            .mapping(true, Stage._1)
            .build();
    public static final TypeMapping<Integer, RailShapeStraight> STRAIGHT_RAIL_SHAPE = new TypeMapping.Builder<Integer, RailShapeStraight>()
            .mapping(0, RailShapeStraight.NORTH_SOUTH)
            .mapping(1, RailShapeStraight.EAST_WEST)
            .mapping(2, RailShapeStraight.ASCENDING_EAST)
            .mapping(3, RailShapeStraight.ASCENDING_WEST)
            .mapping(4, RailShapeStraight.ASCENDING_NORTH)
            .mapping(5, RailShapeStraight.ASCENDING_SOUTH)
            .mapping(6, RailShapeStraight.NORTH_SOUTH) // Legacy state which falls back to north-south
            .mapping(7, RailShapeStraight.NORTH_SOUTH) // Legacy state which falls back to north-south
            .build();
    public static final TypeMapping<String, StructureBlockMode> STRUCTURE_BLOCK_MODE = new TypeMapping.Builder<String, StructureBlockMode>()
            .mapping("save", StructureBlockMode.SAVE)
            .mapping("corner", StructureBlockMode.CORNER)
            .mapping("load", StructureBlockMode.LOAD)
            .mapping("data", StructureBlockMode.DATA)
            .mapping("invalid", StructureBlockMode.INVALID)
            .mapping("export", StructureBlockMode.EXPORT)
            .build();
    public static final TypeMapping<String, StructureVoidType> STRUCTURE_VOID_TYPE = new TypeMapping.Builder<String, StructureVoidType>()
            .mapping("void", StructureVoidType.VOID)
            .mapping("air", StructureVoidType.AIR)
            .build();
    public static final TypeMapping<String, Tilt> TILT = new TypeMapping.Builder<String, Tilt>()
            .mapping("none", Tilt.NONE)
            .mapping("unstable", Tilt.UNSTABLE)
            .mapping("partial_tilt", Tilt.PARTIAL)
            .mapping("full_tilt", Tilt.FULL)
            .build();
    public static final TypeMapping<String, FacingDirectionHorizontal> TORCH_FACING_DIRECTION = new TypeMapping.Builder<String, FacingDirectionHorizontal>()
            .mapping("north", FacingDirectionHorizontal.SOUTH)
            .mapping("east", FacingDirectionHorizontal.WEST)
            .mapping("south", FacingDirectionHorizontal.NORTH)
            .mapping("west", FacingDirectionHorizontal.EAST)
            .build();
    public static final TypeMapping<Integer, TrialSpawnerState> TRIAL_SPAWNER_STATE = new TypeMapping.Builder<Integer, TrialSpawnerState>()
            .mapping(0, TrialSpawnerState.INACTIVE)
            .mapping(1, TrialSpawnerState.WAITING_FOR_PLAYERS)
            .mapping(2, TrialSpawnerState.ACTIVE)
            .mapping(3, TrialSpawnerState.WAITING_FOR_EJECTION)
            .mapping(4, TrialSpawnerState.EJECTING_REWARD)
            .mapping(5, TrialSpawnerState.COOLDOWN)
            .build();
    public static final TypeMapping<String, VaultState> VAULT_STATE = new TypeMapping.Builder<String, VaultState>()
            .mapping("inactive", VaultState.INACTIVE)
            .mapping("active", VaultState.ACTIVE)
            .mapping("unlocking", VaultState.UNLOCKING)
            .mapping("ejecting", VaultState.EJECTING)
            .build();
    public static final TypeMapping<Boolean, VerticalDirection> VERTICAL_DIRECTION = new TypeMapping.Builder<Boolean, VerticalDirection>()
            .mapping(false, VerticalDirection.UP)
            .mapping(true, VerticalDirection.DOWN)
            .build();
    public static final TypeMapping<String, WallHeight> WALL_CONNECTION = new TypeMapping.Builder<String, WallHeight>()
            .mapping("none", WallHeight.NONE)
            .mapping("short", WallHeight.LOW)
            .mapping("tall", WallHeight.TALL)
            .build();
    public static final TypeMapping<Integer, FacingDirectionHorizontal> WEIRDO_DIRECTION = new TypeMapping.Builder<Integer, FacingDirectionHorizontal>()
            .mapping(0, FacingDirectionHorizontal.EAST)
            .mapping(1, FacingDirectionHorizontal.WEST)
            .mapping(2, FacingDirectionHorizontal.SOUTH)
            .mapping(3, FacingDirectionHorizontal.NORTH)
            .build();
    public static final TypeMapping<Integer, FacingDirection> WEIRDO_DIRECTION_ALL = new TypeMapping.Builder<Integer, FacingDirection>()
            .mapping(0, FacingDirection.EAST)
            .mapping(1, FacingDirection.WEST)
            .mapping(2, FacingDirection.SOUTH)
            .mapping(3, FacingDirection.NORTH)
            .mapping(0, FacingDirection.UP)
            .mapping(0, FacingDirection.DOWN)
            .build();
}
